package com.qkst.website.backstage.controller;

import java.io.IOException;
import java.io.PrintWriter;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.baidu.ueditor.ActionEnter;

/**
 * @author lh
 * @description 
 * @date 2017年5月16日 下午2:32:41
 * @email ahlxlihao@163.com
 * 
 */
@Controller  
@RequestMapping("/backstage/ueditor")  
public class UEditController {  
      
    /**
     * 图片上传
     * @param request
     * @param response
     * @throws IOException
     */
    @RequestMapping("/imageUpload.do")  
    public void imageUpload(HttpServletRequest request,HttpServletResponse response) throws IOException{  
    	  response.setContentType("application/json");               
          String rootPath = request.getSession().getServletContext().getRealPath("/");

          try {
                  String exec = new ActionEnter(request, rootPath).exec();
                  PrintWriter writer = response.getWriter();
                  writer.write(exec);
                  writer.flush();
                  writer.close();
          } catch (IOException e) {
                  e.printStackTrace();
          }
    }  
}  